﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOA.MES.DataAccess.VModel
{
    /// <summary>
    /// 入库任务
    /// </summary>
    public class VWmsInboundTask : BaseVModel
    {
        private string _inboundNo = string.Empty;
        private string _workshopCode = string.Empty;
        private string _workshopName = string.Empty;
        private string _fromWarehouse = string.Empty;
        private string _orderNo = string.Empty;
        private string _workOrderNo = string.Empty;
        private string _projectName = string.Empty;
        private string _contactNo = string.Empty;
        private string _cabinetNo = string.Empty;
        private string _packNo = string.Empty;
        private string _currentLevel = string.Empty;
        private string _remark = string.Empty;
        private string _protocolNo;

        #region Public Property

        ///<Summary>
        /// 入库单号
        ///</Summary>
        public string InboundNo
        {
            get { return string.IsNullOrWhiteSpace(_inboundNo) ? string.Empty : _inboundNo; }
            set { _inboundNo = value; }
        }

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        ///<Summary>
        /// 来源子库
        ///</Summary>
        public string FromWarehouse
        {
            get { return string.IsNullOrWhiteSpace(_fromWarehouse) ? string.Empty : _fromWarehouse; }
            set { _fromWarehouse = value; }
        }

        ///<Summary>
        /// 订单号
        ///</Summary>
        public string OrderNo
        {
            get { return string.IsNullOrWhiteSpace(_orderNo) ? string.Empty : _orderNo; }
            set { _orderNo = value; }
        }

        ///<Summary>
        /// 工单号
        ///</Summary>
        public string WorkOrderNo
        {
            get { return string.IsNullOrWhiteSpace(_workOrderNo) ? string.Empty : _workOrderNo; }
            set { _workOrderNo = value; }
        }

        ///<Summary>
        /// 项目名称
        ///</Summary>
        public string ProjectName
        {
            get { return string.IsNullOrWhiteSpace(_projectName) ? string.Empty : _projectName; }
            set { _projectName = value; }
        }

        ///<Summary>
        /// 销售合同号
        ///</Summary>
        public string ContactNo
        {
            get { return string.IsNullOrWhiteSpace(_contactNo) ? string.Empty : _contactNo; }
            set { _contactNo = value; }
        }

        /// <summary>
        /// 协议号
        /// </summary>
        public string ProtocolNo
        {
            get { return string.IsNullOrWhiteSpace(_protocolNo) ? string.Empty : _protocolNo; }
            set { _protocolNo = value; }
        }

        ///<Summary>
        /// 书否需要监造
        ///</Summary>
        public bool NeedSupervision { get; set; }

        ///<Summary>
        /// 柜号
        ///</Summary>
        public string CabinetNo
        {
            get { return string.IsNullOrWhiteSpace(_cabinetNo) ? string.Empty : _cabinetNo; }
            set { _cabinetNo = value; }
        }

        ///<Summary>
        /// 箱号
        ///</Summary>
        public string PackNo
        {
            get { return string.IsNullOrWhiteSpace(_packNo) ? string.Empty : _packNo; }
            set { _packNo = value; }
        }

        ///<Summary>
        /// 功率当
        ///</Summary>
        public decimal PowerLevel { get; set; }

        ///<Summary>
        /// 电流档
        ///</Summary>
        public string CurrentLevel
        {
            get { return string.IsNullOrWhiteSpace(_currentLevel) ? string.Empty : _currentLevel; }
            set { _currentLevel = value; }
        }

        ///<Summary>
        /// 体积
        ///</Summary>
        public decimal Volume { get; set; }

        ///<Summary>
        /// 打包时间
        ///</Summary>
        public DateTime PackTime { get; set; }

        ///<Summary>
        /// 拼柜时间
        ///</Summary>
        public DateTime CabinetTime { get; set; }

        ///<Summary>
        /// 最后尝试时间
        ///</Summary>
        public DateTime? LastTryTime { get; set; }

        ///<Summary>
        /// 重试次数
        ///</Summary>
        public int RetryTimes { get; set; }

        ///<Summary>
        /// 状态
        ///</Summary>
        public Enum.WmsInboundStatus Status { get; set; } = Enum.WmsInboundStatus.WaitingForExcute;

        ///<Summary>
        /// 收货状态
        ///</Summary>
        public Enum.WmsReceiveStatus ReceiveStatus { get; set; } = Enum.WmsReceiveStatus.NotReceive;

        ///<Summary>
        /// 收货时间
        ///</Summary>
        public DateTime? ReceiveTime { get; set; }

        ///<Summary>
        /// 备注
        ///</Summary>
        public string Remark
        {
            get { return string.IsNullOrWhiteSpace(_remark) ? string.Empty : _remark; }
            set { _remark = value; }
        }
        #endregion

        /// <summary>
        /// 入库状态
        /// </summary>
        public string CnStatus { get { return EnumConvert.ToDesc(Status); } }

        /// <summary>
        /// 打包时间
        /// </summary>
        public string PackTimeStr { get { return PackTime.ToString("yyyy-MM-dd HH:mm:ss"); } }

        /// <summary>
        /// 拼柜时间
        /// </summary>
        public string CabinetTimeStr { get { return CabinetTime.ToString("yyyy-MM-dd HH:mm:ss"); } }

        /// <summary>
        /// 最后尝试时间
        /// </summary>
        public string LastTryTimeStr { get { return !LastTryTime.HasValue ? string.Empty : LastTryTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } }

        /// <summary>
        /// 收货状态
        /// </summary>
        public string CnReceiveStatus { get { return EnumConvert.ToDesc(ReceiveStatus); } }

        /// <summary>
        /// 收货时间
        /// </summary>
        public string ReceiveTimeStr { get { return !ReceiveTime.HasValue ? string.Empty : ReceiveTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } }
    }
}
